   package com.javalong.affairs.module.userModule.adapter;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.javalong.affairs.R;
import com.javalong.affairs.base.adapter.BaseAdapter;
import com.javalong.affairs.base.model.User;

public class UserAdapter extends BaseAdapter {
	private List<User> selectedUsers;
	private boolean hasCheck;

	public UserAdapter(Context context, List<User> deptList) {
		this(context, deptList, true);
	}

	public UserAdapter(Context context, List<User> deptList, boolean hasCheck) {
		super(context, deptList);
		selectedUsers = new ArrayList<User>();
		this.hasCheck = hasCheck;
	}

	public List<User> getSelectedUsers() {
		return selectedUsers;
	}

	@Override
	public void notifyDataSetChanged() {
		super.notifyDataSetChanged();
		selectedUsers.clear();
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		final User dept = (User) getItem(position);
		ViewHolder holder;
		if (convertView != null) {
			holder = (ViewHolder) convertView.getTag();
		} else {
			holder = new ViewHolder();
			convertView = mInflater.inflate(R.layout.item_user, null);
			holder.tv_user = (TextView) convertView.findViewById(R.id.tv_user);
			convertView.setTag(holder);
		}
		return convertView;
	}

	class ViewHolder {
		TextView tv_user;
	}

}
